<template >
  <div class="body_class">
    <el-empty :description="err"  v-loading="loading"></el-empty>

  </div>
    
    
</template>
<script>
 import axios from 'axios'
 import Fingerprint2 from 'fingerprintjs2'
 
    export default {
        components: {

        },
        data() {
            return {
              loading: true,
                numberValidateForm: {
                    code: '',
                   
                    fp:''
        },
        err:'授权中，请稍后'
            };
        },
        mounted: function () {
            var that=this
            const params = new URLSearchParams(window.location.search);
            that.numberValidateForm.code = params.get('code'); // John

            Fingerprint2.get(function(components){
                
    const values=components.map(function(component,index){
      if(index===0){
        return component.value.replace(/\bNetType\/\w+\b/,'')
      }
      return component.value
      
    })
    const murmur=Fingerprint2.x64hash128(values.join(''),31)
    that.numberValidateForm.fp=murmur
      console.log('浏览器指纹吗',that.numberValidateForm.fp)
      that.submitForm()
  })

        },
        destroyed:function(){
            clearInterval(this.timer)
        },
        methods: {
           
            submitForm() {
              var that=this
              axios({
                method: 'post',
                url: 'http://doudian-api.fd1.cc/api/add_agent_fp',
                params:that.numberValidateForm
            })
                .then(function (response) { 
     
                  if(response.data.code==0){
                    that.$router.push('/')
                  }else{
                    that.err=response.data.message
                  }
                   
                })
                .catch(function (error) {
                    console.log(error)
                })
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      }   
            

        },
        created: function () {
     
            
        }
    }
</script>
<style lang="less">
  /* .body_class{
    background-image: url('../assets/bj2.png') ;
        background-size: cover;
  background-repeat: no-repeat;
  background-position: center center;
  height:100vh;
  width: 100vw;
  } */
     
.body_yzm{
    
    padding: 200px;
}

.el-form-item__label{
color: black;
}
</style>